#include<iostream>
#include<vector>
#include<assert.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>

using namespace std;

typedef void (*fun_c)(); 

void PrintLog()
{
  cout << "pid: " << getpid() << " " << "正在执行打印日志的任务" << endl;
}

void InsertMySQL()
{
  cout << "正在执行数据库内容的输入" << endl;
}

void NetRequest()
{
  cout << "正在执行网络请求" << endl;
}

class Task
{
public:
  Task()
  {
    TaskCtrl.push_back(PrintLog);
    TaskCtrl.push_back(InsertMySQL);
    TaskCtrl.push_back(NetRequest);
  }
  void Excute(int command)
  {
    if(command >= 0 && command < (int)TaskCtrl.size()) TaskCtrl[command]();
  }
private:
  vector<fun_c> TaskCtrl;
};


